﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Content;

namespace Solitaire {
    class KlondikeSlot: Slot {
        private static int sepDown = 3;
        private static int sepUp = 10;

        public KlondikeSlot(Vector2 pos): base(pos) {
        }
        
        public KlondikeSlot() : base() { }

        public void addCards(List<Card> toAdd) {
            slot.Union(toAdd);
        }

        public new void Draw(GameTime gameTime, SpriteBatch spriteBatch) {
            Card tmpCard, tmpPrev = null;
            Vector2 tmpPos = Position;
            int sep = sepDown;

            for(int i = 0; i < slot.Count; i++) {
                tmpCard = slot.ElementAt<Card>(i);

                if (tmpPrev == null)
                    sep = 0;
                else if (tmpPrev.FaceUp == false)
                    sep = sepDown;
                else
                    sep = sepUp;

                tmpCard.setPosition(new Vector2(tmpPos.X, tmpPos.Y += sep));
                tmpCard.Draw(gameTime, spriteBatch);
                tmpPrev = tmpCard;
            }
        }
    }
}
